export const ObjectMixin = {
  props: {
    object: []
  },
  data () {
    return {
      total: 0,
      dialogDelete: false,
      currentPage: 1,
      pageSize: 4,
      list: [],
      selectArticle: []
    }
  },
  computed: {
    tableHeight () {
      return window.innerHeight - 320
    }
  },
  methods: {
    view (object) {
      this.$router.push(
        {
          name: 'article',
          params: {
            apId: object.id
          }
        }
      )
    },
    edit (object) {
      this.$router.push(
        {
          name: 'editor',
          params: {
            object: object,
            edit: true
          }
        }
      )
    },
    delete (object) {
      this.dialogDelete = true
      this.selectArticle = object
    },
    handleCurrentChange: function (currentPage) {
      this.currentPage = currentPage
      this.editArticle('load')
    },
    confirmDelete (selectObject) {
      this.$emit('del', selectObject)
    }
  },
  mounted () {
    this.loadObject()
  }
}
